export default function(title, limit = 5) {
  return {
    created() {
      this.tempRoute = Object.assign({}, this.$route)
    },
    methods: {
      setTagsViewTitle(detail) {
        const route = Object.assign({}, this.tempRoute, {
          title: `${title} - ${detail}`
        })
        this.$store.dispatch('tagsView/updateVisitedView', route)
      },
      resetCustomTitle(customTitle = '') {
        title = customTitle
      },
      setPageTitle(detail) {
        document.title = `${title} - ${detail}`
      },
      setCurrentTitle(detail) {
        this.setTagsViewTitle(detail)
        this.setPageTitle(detail)
      }
    }
  }
}
